<template>
  <div class="nav_wrap">
    <!-- 写在右上方的导航栏，可以实现弹出和隐藏 -->
    <div :class="['top_nav', show ? 'top_nav_show' : '']">

      <router-link style="text-decoration: none;" to="/about">
        <div class="top_nav_item">
          <img src="./images/小岛.png">
          <span>关于我</span>
        </div>
      </router-link>

      <!-- 写编程式路由导航 -->
      <div @click="sendShow" class="top_nav_item">
        <img src="./images/星空.png">
        <span>日志</span>
      </div>


      <router-link style="text-decoration: none;" to="/message">
        <div class="top_nav_item">
          <img src="./images/海上.png">
          <span>留言</span>
        </div>
      </router-link>

      <router-link style="text-decoration: none;" to="/myheart">
        <div class="top_nav_item">
          <img src="./images/秋天.png">
          <span>树说说</span>
        </div>
      </router-link>
    </div>
    <!-- 这里写那个下拉绳子 -->
    <div @click="show = !show" class="rope"><img src="./images/圣诞铃铛.png"></div>
  </div>
</template>

<script>
export default {
  name: 'Navigation',
  data() {
    return {
      show: false,
    }
  },
  methods: {
    sendShow() {
      this.$root.$emit("open", true)
    }
  },
}
</script>

<style scoped>
.top_nav {
  position: absolute;
  z-index: 11;
  right: 60px;
  width: 360px;
  height: 80px;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  /* 这里算是给他一个隐藏 */
  transform: translateY(-80px);
  transition: 0.3s;
}

.top_nav_show {
  transform: translateY(0);
}

.top_nav_item {
  width: 80px;
  height: 100%;
  display: flex;
  justify-content: space-around;
  align-items: center;
  flex-direction: column;
  cursor: pointer;
}

.top_nav_item>img {
  width: 60px;
  transition: 0.1s;
}

.top_nav_item>span {
  color: RGBA(248, 180, 201, .6);
}

.top_nav_item:hover span {
  color: RGB(248, 180, 201);
}

@media screen and (max-width: 780px) {
  .top_nav_item>span {
    color: #4984C2aa;
  }

  .top_nav_item:hover span {
    color: #4984C2;
  }
}

.top_nav_item:active img {
  transform: scale(1.5);
}

.rope {
  position: absolute;
  right: 0;
  z-index: 11;
  height: 240px;
  width: 60px;
  background-image: url(./images/rope.png);
  background-size: contain;
  background-repeat: no-repeat;
  transform: translateY(-60px);
  cursor: pointer;
  transition: 0.2s;
}

.rope>img {
  position: relative;
  top: 230px;
  left: -3px;
}

.rope:active {
  transform: translateY(0px);
}
</style>